<template>
    <div>
        <div class="topnav">
            <div class="topnav_bd w1210 bc">
                <div class="topnav_left">

                </div>
                <div class="topnav_right fr">
                    <ul>
                        <li>您好，{{name}},欢迎来到聚美优品！<span v-if="name==null">[<a @click="loginOrRegister('login')" href="#">登录</a>] </span> <span v-if="name!=null"> [<a href="#" @click.prevent="logout">退出</a>] </span> [<a @click="loginOrRegister('register')"  href="#">免费注册</a>]</li>
                        <li class="line">|</li>
                        <li>我的订单</li>
                        <li class="line">|</li>
                        <li>客户服务</li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</template>

<script>

export default {
    data(){
        return{
            //TODO
            // name:'张三'
            name : ''
        }
    },
    // name:index-top
    methods:{
        loginOrRegister(flag){
            this.$router.push('/'+flag)
        }
    },
	mounted(){
		this.name = localStorage.getItem("name")
	}
}
</script>

<style>

</style>
